package com.hliu.web.controller;

import com.hliu.test.model.TestBean;
import com.hliu.test.service.ITestHibernateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * author: 6
 * date: 13-4-8
 */
@Controller
@RequestMapping("/index")
public class  TestController {

	@Autowired
	@Qualifier("testHibernateService")
	private ITestHibernateService testService;

	@RequestMapping(method = RequestMethod.GET)
	public String index(Model model) {
		List<TestBean> tests = testService.list();
		model.addAttribute("tests", tests);
		return "index";
	}

	@RequestMapping(value = "/adx", method = RequestMethod.GET)
	public String test() {
		testService.testTransaction();
		return "index";
	}
}
